{smcl}
{txt}{sf}{ul off}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}E:\Github\Bolivia\00_replication_files\log-files/2_Figure_D3.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}25 Jan 2022, 22:38:21
{txt}
{com}. 
. timer on 2
{txt}
{com}. 
. *------------*
. * Figure D.3 *
. *------------*
.         * Figure D.3.a
.         *-------------
.                 use "data/outputs/computo_verificadortrepdate_missingsatthend.dta", clear       
{txt}
{com}.                         
.                 * Creating a unique ordered ID for the problem precincts
.                 sort trep_missing_date pcs_so
{txt}
{com}.                 gen order = sum(trep_missing_date)
{txt}
{com}.                 replace order = 10000 + _n if order == 0
{txt}(33,044 real changes made)

{com}. 
.                 * Creating a sorted tempfile of mshare and cshare just for problem precincts
.                 preserve
{txt}
{com}.                         keep if trep_missing_date == 1
{txt}(33,044 observations deleted)

{com}.                         keep mshare_so cshare_so
{txt}
{com}.                         sort mshare_so
{txt}
{com}.                         rename mshare_so mshare_sorted
{res}{txt}
{com}.                         rename cshare_so cshare_sorted
{res}{txt}
{com}.                         gen order = _n
{txt}
{com}.                         tempfile sorted
{txt}
{com}.                         save `sorted'
{txt}file C:\Users\Nicolas\AppData\Local\Temp\ST_2420_000002.tmp saved

{com}.                 restore
{txt}
{com}. 
.                 * Merging sorted mshare and cshare
.                 merge 1:1 order using `sorted'
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}          33,044
{txt}{col 9}from master{col 30}{res}          33,044{txt}  (_merge==1)
{col 9}from using{col 30}{res}               0{txt}  (_merge==2)

{col 5}matched{col 30}{res}           1,511{txt}  (_merge==3)
{col 5}{hline 41}

{com}.                 drop order _m
{txt}
{com}. 
.                 sort pcs_so
{txt}
{com}. 
.                 replace mshare_sorted = mshare_so if mshare_sorted == . & ///
>                         trep_missing_date == 0
{txt}(33,042 real changes made)

{com}.                 replace cshare_sorted = cshare_so if cshare_sorted == . & ///
>                         trep_missing_date == 0
{txt}(33,042 real changes made)

{com}. 
.                 gen nulosshare = Nulos / total_so
{txt}(4 missing values generated)

{com}. 
.                 * Recinto ID
.                 egen reci_id = group(Pais Dep Prov Muni Loc Reci)
{txt}
{com}.                            /* Note, in constructing the data set we made a correction
>                            such that recinto names are unique within localities. */
. 
.                 foreach var of varlist mshare_so cshare_so nulosshare {c -(}
{txt}  2{com}.                         egen reci_mean = mean(`var'), by(reci_id)
{txt}  3{com}.                         gen `var'_dm = `var' - reci_mean 
{txt}  4{com}.                         drop reci_mean
{txt}  5{com}.                         qui su `var'
{txt}  6{com}.                         gen `var'_dm_plus = `var'_dm + `r(mean)' // Add overall mean for scale
{txt}  7{com}.                 {c )-}
{txt}(4 missing values generated)
(4 missing values generated)
(4 missing values generated)
(4 missing values generated)
(4 missing values generated)
(4 missing values generated)

{com}. 
.                 lprobust nulosshare pcs_so, genvars
{res}
Local Polynomial Regression Estimation and Inference.

{txt}{lalign 1: Sample size                              (n=)    }{col 19}{res}          34551
{txt}{lalign 1: Polynomial order for point estimation    (p=)    }{col 19}{res}              1
{txt}{lalign 1: Order of derivative estimated            (v=)    }{col 19}{res}              0
{txt}{lalign 1: Polynomial order for confidence interval (q=)    }{col 19}{res}              2
{txt}{lalign 1: Kernel function                                  }{col 19}{res}{ralign 15: Epanechnikov}
{txt}{lalign 1: Bandwidth selection method                       }{col 19}{res}{ralign 15: imse-dpi}

{txt}{hline 72}
{ralign 4: }{col 4}{ralign 10: }{col 14}{ralign 10: }{col 24}{ralign 8: }{col 32}{ralign 10: Point}{col 42}{ralign 10: Std.}{col 52}{ralign 20: Robust B.C.}{col 72}
{ralign 4: }{col 4}{ralign 10: eval}{col 14}{ralign 10: bw}{col 24}{ralign 8: Eff.n}{col 32}{ralign 10: Est.}{col 42}{ralign 10: Error}{col 52}{ralign 20: 95% Conf. Interval}{col 72}
{hline 72}
   1{col 4}{res}    0.0151{col 14}    0.2883{col 24}   11459{col 32}    0.0326{col 42}    0.0005{col 52}    0.0317{col 62}    0.0343{col 72}
{txt}   2{col 4}{res}    0.0379{col 14}    0.2883{col 24}   12210{col 32}    0.0327{col 42}    0.0004{col 52}    0.0318{col 62}    0.0337{col 72}
{txt}   3{col 4}{res}    0.0669{col 14}    0.2883{col 24}   13162{col 32}    0.0328{col 42}    0.0004{col 52}    0.0320{col 62}    0.0333{col 72}
{txt}   4{col 4}{res}    0.0973{col 14}    0.2883{col 24}   14168{col 32}    0.0329{col 42}    0.0003{col 52}    0.0322{col 62}    0.0333{col 72}
{txt}   5{col 4}{res}    0.1290{col 14}    0.2883{col 24}   15207{col 32}    0.0331{col 42}    0.0002{col 52}    0.0324{col 62}    0.0335{col 72}
{txt}{hline 72}
   6{col 4}{res}    0.1615{col 14}    0.2883{col 24}   16274{col 32}    0.0333{col 42}    0.0002{col 52}    0.0327{col 62}    0.0337{col 72}
{txt}   7{col 4}{res}    0.1942{col 14}    0.2883{col 24}   17340{col 32}    0.0335{col 42}    0.0002{col 52}    0.0330{col 62}    0.0340{col 72}
{txt}   8{col 4}{res}    0.2273{col 14}    0.2883{col 24}   18415{col 32}    0.0337{col 42}    0.0002{col 52}    0.0332{col 62}    0.0343{col 72}
{txt}   9{col 4}{res}    0.2606{col 14}    0.2883{col 24}   19502{col 32}    0.0339{col 42}    0.0002{col 52}    0.0334{col 62}    0.0344{col 72}
{txt}  10{col 4}{res}    0.2940{col 14}    0.2883{col 24}   20262{col 32}    0.0341{col 42}    0.0002{col 52}    0.0337{col 62}    0.0347{col 72}
{txt}{hline 72}
  11{col 4}{res}    0.3278{col 14}    0.2883{col 24}   19421{col 32}    0.0343{col 42}    0.0002{col 52}    0.0339{col 62}    0.0349{col 72}
{txt}  12{col 4}{res}    0.3617{col 14}    0.2883{col 24}   19242{col 32}    0.0346{col 42}    0.0002{col 52}    0.0340{col 62}    0.0350{col 72}
{txt}  13{col 4}{res}    0.3955{col 14}    0.2883{col 24}   19130{col 32}    0.0349{col 42}    0.0002{col 52}    0.0342{col 62}    0.0352{col 72}
{txt}  14{col 4}{res}    0.4293{col 14}    0.2883{col 24}   19051{col 32}    0.0352{col 42}    0.0002{col 52}    0.0344{col 62}    0.0354{col 72}
{txt}  15{col 4}{res}    0.4635{col 14}    0.2883{col 24}   18987{col 32}    0.0354{col 42}    0.0002{col 52}    0.0348{col 62}    0.0357{col 72}
{txt}{hline 72}
  16{col 4}{res}    0.4977{col 14}    0.2883{col 24}   18951{col 32}    0.0357{col 42}    0.0002{col 52}    0.0351{col 62}    0.0361{col 72}
{txt}  17{col 4}{res}    0.5319{col 14}    0.2883{col 24}   18914{col 32}    0.0359{col 42}    0.0002{col 52}    0.0355{col 62}    0.0365{col 72}
{txt}  18{col 4}{res}    0.5660{col 14}    0.2883{col 24}   18897{col 32}    0.0361{col 42}    0.0002{col 52}    0.0358{col 62}    0.0368{col 72}
{txt}  19{col 4}{res}    0.6001{col 14}    0.2883{col 24}   18886{col 32}    0.0363{col 42}    0.0002{col 52}    0.0361{col 62}    0.0371{col 72}
{txt}  20{col 4}{res}    0.6336{col 14}    0.2883{col 24}   18896{col 32}    0.0366{col 42}    0.0002{col 52}    0.0362{col 62}    0.0372{col 72}
{txt}{hline 72}
  21{col 4}{res}    0.6676{col 14}    0.2883{col 24}   18967{col 32}    0.0370{col 42}    0.0002{col 52}    0.0363{col 62}    0.0373{col 72}
{txt}  22{col 4}{res}    0.7015{col 14}    0.2883{col 24}   19111{col 32}    0.0374{col 42}    0.0002{col 52}    0.0365{col 62}    0.0375{col 72}
{txt}  23{col 4}{res}    0.7364{col 14}    0.2883{col 24}   18339{col 32}    0.0378{col 42}    0.0002{col 52}    0.0367{col 62}    0.0377{col 72}
{txt}  24{col 4}{res}    0.7705{col 14}    0.2883{col 24}   17228{col 32}    0.0381{col 42}    0.0002{col 52}    0.0370{col 62}    0.0381{col 72}
{txt}  25{col 4}{res}    0.8050{col 14}    0.2883{col 24}   16106{col 32}    0.0385{col 42}    0.0002{col 52}    0.0374{col 62}    0.0385{col 72}
{txt}{hline 72}
  26{col 4}{res}    0.8388{col 14}    0.2883{col 24}   15002{col 32}    0.0389{col 42}    0.0002{col 52}    0.0379{col 62}    0.0390{col 72}
{txt}  27{col 4}{res}    0.8727{col 14}    0.2883{col 24}   13890{col 32}    0.0394{col 42}    0.0003{col 52}    0.0385{col 62}    0.0397{col 72}
{txt}  28{col 4}{res}    0.9062{col 14}    0.2883{col 24}   12779{col 32}    0.0400{col 42}    0.0003{col 52}    0.0393{col 62}    0.0405{col 72}
{txt}  29{col 4}{res}    0.9387{col 14}    0.2883{col 24}   11716{col 32}    0.0406{col 42}    0.0004{col 52}    0.0398{col 62}    0.0413{col 72}
{txt}  30{col 4}{res}    0.9701{col 14}    0.2883{col 24}   10678{col 32}    0.0412{col 42}    0.0005{col 52}    0.0398{col 62}    0.0420{col 72}
{txt}{hline 72}

{com}.                         
.                 twoway (line lprobust_gx_bc lprobust_eval, ///
>                                         lcolor(gs6) lwidth(medthick)) ///
>                         (line lprobust_CI_l_rb lprobust_eval, ///
>                                 lcolor(gs6) lwidth(thin) lpattern(dash)) ///
>                         (line lprobust_CI_r_rb lprobust_eval, ///
>                                 lcolor(gs6) lwidth(thin) lpattern(dash)), ///
>                         graphregion(color(white)) ///
>                         ylab(, angle(0)) ///
>                         xlab() ///
>                         ytitle("Percent Null Ballots") ///
>                         xtitle("Proportion of Preliminary Vote Counted") ///
>                         xsize(7) ysize(5.55) ///
>                         legend(off)
{res}{txt}
{com}.                 graph export "outputs/generated/Figure_D3a.pdf", replace
{txt}(file outputs/generated/Figure_D3a.pdf written in PDF format)

{com}. 
.         * Figure D.3.b
.         *-------------
.                 drop lprobust*
{txt}
{com}.                 lprobust nulosshare_dm pcs_so, genvars
{res}
Local Polynomial Regression Estimation and Inference.

{txt}{lalign 1: Sample size                              (n=)    }{col 19}{res}          34551
{txt}{lalign 1: Polynomial order for point estimation    (p=)    }{col 19}{res}              1
{txt}{lalign 1: Order of derivative estimated            (v=)    }{col 19}{res}              0
{txt}{lalign 1: Polynomial order for confidence interval (q=)    }{col 19}{res}              2
{txt}{lalign 1: Kernel function                                  }{col 19}{res}{ralign 15: Epanechnikov}
{txt}{lalign 1: Bandwidth selection method                       }{col 19}{res}{ralign 15: imse-dpi}

{txt}{hline 72}
{ralign 4: }{col 4}{ralign 10: }{col 14}{ralign 10: }{col 24}{ralign 8: }{col 32}{ralign 10: Point}{col 42}{ralign 10: Std.}{col 52}{ralign 20: Robust B.C.}{col 72}
{ralign 4: }{col 4}{ralign 10: eval}{col 14}{ralign 10: bw}{col 24}{ralign 8: Eff.n}{col 32}{ralign 10: Est.}{col 42}{ralign 10: Error}{col 52}{ralign 20: 95% Conf. Interval}{col 72}
{hline 72}
   1{col 4}{res}    0.0151{col 14}    0.5033{col 24}   18507{col 32}   -0.0009{col 42}    0.0003{col 52}   -0.0018{col 62}   -0.0002{col 72}
{txt}   2{col 4}{res}    0.0379{col 14}    0.5033{col 24}   19254{col 32}   -0.0008{col 42}    0.0003{col 52}   -0.0015{col 62}   -0.0002{col 72}
{txt}   3{col 4}{res}    0.0669{col 14}    0.5033{col 24}   20200{col 32}   -0.0008{col 42}    0.0002{col 52}   -0.0013{col 62}   -0.0003{col 72}
{txt}   4{col 4}{res}    0.0973{col 14}    0.5033{col 24}   21198{col 32}   -0.0007{col 42}    0.0002{col 52}   -0.0011{col 62}   -0.0003{col 72}
{txt}   5{col 4}{res}    0.1290{col 14}    0.5033{col 24}   22251{col 32}   -0.0006{col 42}    0.0002{col 52}   -0.0009{col 62}   -0.0003{col 72}
{txt}{hline 72}
   6{col 4}{res}    0.1615{col 14}    0.5033{col 24}   23315{col 32}   -0.0006{col 42}    0.0002{col 52}   -0.0008{col 62}   -0.0002{col 72}
{txt}   7{col 4}{res}    0.1942{col 14}    0.5033{col 24}   24394{col 32}   -0.0005{col 42}    0.0001{col 52}   -0.0007{col 62}   -0.0001{col 72}
{txt}   8{col 4}{res}    0.2273{col 14}    0.5033{col 24}   25447{col 32}   -0.0004{col 42}    0.0001{col 52}   -0.0007{col 62}   -0.0001{col 72}
{txt}   9{col 4}{res}    0.2606{col 14}    0.5033{col 24}   26538{col 32}   -0.0004{col 42}    0.0001{col 52}   -0.0006{col 62}    0.0000{col 72}
{txt}  10{col 4}{res}    0.2940{col 14}    0.5033{col 24}   27620{col 32}   -0.0003{col 42}    0.0001{col 52}   -0.0005{col 62}    0.0001{col 72}
{txt}{hline 72}
  11{col 4}{res}    0.3278{col 14}    0.5033{col 24}   28731{col 32}   -0.0003{col 42}    0.0001{col 52}   -0.0005{col 62}    0.0001{col 72}
{txt}  12{col 4}{res}    0.3617{col 14}    0.5033{col 24}   29846{col 32}   -0.0002{col 42}    0.0001{col 52}   -0.0004{col 62}    0.0002{col 72}
{txt}  13{col 4}{res}    0.3955{col 14}    0.5033{col 24}   30970{col 32}   -0.0001{col 42}    0.0001{col 52}   -0.0004{col 62}    0.0002{col 72}
{txt}  14{col 4}{res}    0.4293{col 14}    0.5033{col 24}   32114{col 32}   -0.0001{col 42}    0.0001{col 52}   -0.0003{col 62}    0.0003{col 72}
{txt}  15{col 4}{res}    0.4635{col 14}    0.5033{col 24}   33320{col 32}   -0.0000{col 42}    0.0001{col 52}   -0.0003{col 62}    0.0003{col 72}
{txt}{hline 72}
  16{col 4}{res}    0.4977{col 14}    0.5033{col 24}   34555{col 32}    0.0000{col 42}    0.0001{col 52}   -0.0002{col 62}    0.0003{col 72}
{txt}  17{col 4}{res}    0.5319{col 14}    0.5033{col 24}   32726{col 32}    0.0001{col 42}    0.0001{col 52}   -0.0002{col 62}    0.0004{col 72}
{txt}  18{col 4}{res}    0.5660{col 14}    0.5033{col 24}   31362{col 32}    0.0002{col 42}    0.0001{col 52}   -0.0002{col 62}    0.0004{col 72}
{txt}  19{col 4}{res}    0.6001{col 14}    0.5033{col 24}   30118{col 32}    0.0002{col 42}    0.0001{col 52}   -0.0001{col 62}    0.0005{col 72}
{txt}  20{col 4}{res}    0.6336{col 14}    0.5033{col 24}   28938{col 32}    0.0003{col 42}    0.0001{col 52}   -0.0001{col 62}    0.0005{col 72}
{txt}{hline 72}
  21{col 4}{res}    0.6676{col 14}    0.5033{col 24}   27771{col 32}    0.0003{col 42}    0.0001{col 52}   -0.0000{col 62}    0.0006{col 72}
{txt}  22{col 4}{res}    0.7015{col 14}    0.5033{col 24}   26617{col 32}    0.0004{col 42}    0.0001{col 52}    0.0000{col 62}    0.0006{col 72}
{txt}  23{col 4}{res}    0.7364{col 14}    0.5033{col 24}   25447{col 32}    0.0004{col 42}    0.0001{col 52}    0.0001{col 62}    0.0007{col 72}
{txt}  24{col 4}{res}    0.7705{col 14}    0.5033{col 24}   24304{col 32}    0.0005{col 42}    0.0001{col 52}    0.0002{col 62}    0.0008{col 72}
{txt}  25{col 4}{res}    0.8050{col 14}    0.5033{col 24}   23155{col 32}    0.0005{col 42}    0.0001{col 52}    0.0002{col 62}    0.0008{col 72}
{txt}{hline 72}
  26{col 4}{res}    0.8388{col 14}    0.5033{col 24}   22043{col 32}    0.0006{col 42}    0.0002{col 52}    0.0003{col 62}    0.0009{col 72}
{txt}  27{col 4}{res}    0.8727{col 14}    0.5033{col 24}   20926{col 32}    0.0007{col 42}    0.0002{col 52}    0.0003{col 62}    0.0010{col 72}
{txt}  28{col 4}{res}    0.9062{col 14}    0.5033{col 24}   19824{col 32}    0.0007{col 42}    0.0002{col 52}    0.0003{col 62}    0.0011{col 72}
{txt}  29{col 4}{res}    0.9387{col 14}    0.5033{col 24}   18750{col 32}    0.0008{col 42}    0.0002{col 52}    0.0002{col 62}    0.0013{col 72}
{txt}  30{col 4}{res}    0.9701{col 14}    0.5033{col 24}   17729{col 32}    0.0008{col 42}    0.0003{col 52}    0.0001{col 62}    0.0015{col 72}
{txt}{hline 72}

{com}. 
.                 twoway (line lprobust_gx_bc lprobust_eval, ///
>                                         lcolor(gs6) lwidth(medthick)) ///
>                         (line lprobust_CI_l_rb lprobust_eval, ///
>                                 lcolor(gs6) lwidth(thin) lpattern(dash)) ///
>                         (line lprobust_CI_r_rb lprobust_eval, ///
>                                 lcolor(gs6) lwidth(thin) lpattern(dash)), ///           
>                         graphregion(color(white)) ///
>                         ylab(,angle(0)) ///
>                         xlab() ///
>                         ytitle("Percent Null Ballots (De-Meaned by Precinct)") ///
>                         xtitle("Proportion of Preliminary Vote Counted") ///
>                         xsize(7) ysize(5.55) ///
>                         legend(off)
{res}{txt}
{com}.                 graph export "outputs/generated/Figure_D3b.pdf", replace
{txt}(file outputs/generated/Figure_D3b.pdf written in PDF format)

{com}. 
. *------------------------------------------------------------------------------*
. timer off 2
{txt}
{com}. timer list 2
{res}   2:     61.74 /        1 =      61.7400
{txt}
{com}. 
. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}E:\Github\Bolivia\00_replication_files\log-files/2_Figure_D3.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}25 Jan 2022, 22:39:22
{txt}{.-}
{smcl}
{txt}{sf}{ul off}